﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace AngryNerds
{
    public class RedBird
    {
        public Texture2D myTexture;
        public Vector2 myPosition;
        public Vector2 myCenter;
        public float myRotation;
        public bool start;
        public Color[] myTextureData;

        public RedBird()
        {
            myPosition = Vector2.Zero;
            myCenter = Vector2.Zero;
            myRotation = 0.0f;
            start = false;
        }

        public RedBird(Texture2D texture, Vector2 position, Vector2 center, float rotation)
        {
            myTexture = texture;
            myPosition = position;
            myCenter = center;
            myRotation = rotation;
            start = false;
        }

        public void Draw(int mode, SpriteBatch spriteBatch)
        {
            int axisY = mode * 46;
            Rectangle r = new Rectangle(0, axisY, 49, 46);
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            spriteBatch.Draw(myTexture, myPosition, r, Color.White, myRotation, myCenter, 1, SpriteEffects.None, 0);
            spriteBatch.End();
        }

        public Rectangle BoundingBox()
        {
                return new Rectangle(
                    (int)myPosition.X,
                    (int)myPosition.Y,
                    myTexture.Width,
                    myTexture.Height/3);
        }

        public float Distance(Vector2 point)
        {
            return (float)Math.Sqrt(Math.Pow(myPosition.X-point.X,2)+Math.Pow(myPosition.Y-point.Y,2));
        }
    }
}
